// var url = "wss://192.168.10.117:8989";//websocket端口
// var url ="wss://wcysocket.pxrun.com";//websocket端口
var url = "wss://192.168.10.14:8989";//websocket端口
function connect(user,func){
    //连接socket
    wx.connectSocket({
      url: url,
      header: { 'content-type': 'application/json'},
      method: 'GET',
    })
    //连接成功
    wx.onSocketOpen(function(res){ 
      console.log('WebSocket连接打开！')
    })
    wx.onSocketError(function (res) {
      console.log(url);
      console.log('WebSocket连接打开失败，请检查！')
    })
}
//发送信息
function send(msg){
  wx.sendSocketMessage({
    data: msg,
  })
}
function userid(){
  var userid = Date.parse(new Date());
  return userid;
}
module.exports={
  connect: connect,
  send: send,
  userid:userid
}
